<template>
<div>
  <button @click="dj">点击展示奇数</button><br>
  <span v-for="user in users" class="aaaa">
    {{user.data}}--{{user.name}}--{{user.address}}<br>
  </span>
</div>
</template>

<script>
export default {
  name: "ListView",
  data() {
    return {
      users:[
          {data:'2016-05-02',name:'王小虎',address:'上海市普陀区金沙江路1518弄'},
          {data:'2016-05-04',name:'王小虎',address:'上海市普陀区金沙江路1518弄'},
          {data:'2016-05-01',name:'王小虎',address:'上海市普陀区金沙江路1518弄'},
          {data:'2016-05-03',name:'王小虎',address:'上海市普陀区金沙江路1518弄'}
      ]
    }
  }, methods: {
    dj(){
      this.users.forEach((u,key)=>{
        if ((key+1)%2==0){
          alert(key)
        }
      })
    }
  }, created() {
  }
}
</script>

<style scoped>
.aaaa:hover{
  background-color: #42b983;
}
</style>